<template>
  <div class="detail">
    <el-container >
      <el-header class="outHeader">
        <el-row class="headerRow" type="flex">
          <el-col :span="2" :xs="4" >
            <el-image :src="require('../assets/home/book.png')" class="mainImg"></el-image>
          </el-col>
          <el-col :span="8" :xs="8" >
            <div @keyup.enter="doSearch">
              <el-input placeholder="搜寻你想要的书名" suffix-icon="el-icon-search" v-model="input" class="searchText">
              </el-input>
            </div>
          </el-col>
        </el-row>
      </el-header>

      <!-- 主体内容区域 -->
      <el-main class="outMain">
        <el-card class="box-card">
          <el-row>
            <el-col :span="24">
              <el-divider content-position="left"><i class="el-icon-document"></i> BookInfo
              </el-divider>
            </el-col>
          </el-row>

          <el-row type="flex" justify="space-around">
            <el-col :span="6" class="content-img-col">
              <el-image :src="require('@/assets/logo.png')" class="listImg" />
            </el-col>
            <el-col :span="16" class="content-col">
              <el-row>
                <el-col :span="24">
                  <h3 style="margin:0px">书名{{book.name}}</h3>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <span>作者:{{book.author}}</span>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <span>出版时间:{{book.publishTime}}</span>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <span>出版商:{{book.publisher}}</span>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <span>数量:{{book.quantity}}</span>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <span>价格:{{book.price}}</span>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <span>ISBN:{{book.isbn}}</span>
                </el-col>
              </el-row>

            </el-col>
          </el-row>

          <el-row>
            <el-col :span="24">
              <el-divider content-position="left"><i class="el-icon-edit-outline"></i>
                BriefIntro</el-divider>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <p style="min-height: 60px; margin-top: 5px; margin-bottom:25px ">
                书籍简介:{{book.description}}
              </p>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="24">
              <el-divider content-position="left"><i class="el-icon-chat-dot-square"></i>
                Comments</el-divider>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="24">
              <el-card class="box-card">
                <div v-for="o in 4" :key="o" class="text item">
                  {{'列表内容 ' + o }}
                </div>
              </el-card>
            </el-col>
          </el-row>

        </el-card>
      </el-main>
    </el-container>
  </div>
</template>

<script>
  export default {
    props: {
      "id": String
    },
    name: 'detailInfo',
    data() {
      return {
        input: "请搜索",
        comments: ['a', 'b', 'c', 'd', 'e'],
        book: {

        },
      };
    },
    methods: {
      doSearch: function () {
        // this.$router.push({path:'/about'});
        this.$router.push({
          name: "About",
          path: '/about',
          params: {
            inputTR: this.input,
          }
        });
      }
    },
    mounted() {
      this.input = this.$route.params.inputTR;
      this.book = this.$route.params.bookInfo;
    },
  }
</script>

<style scoped>
  .detail {
    height: 100%;
  }

  .el-container {
    height: 100%;
    background-color: #e2dfd7;
  }

  .outHeader {
    margin-bottom: 10px;

  }

  .mainImg {
    height: 50px;
    width: 50px;
  }

  .searchText {
    margin-top: 5px;
  }

  .headerRow {
    margin-top: 10px;
  }

  .outMain {
    background-color: #f3ebe1;
    text-align: left;
    line-height: 1.5;
  }

  .box-card {
    max-width: 1000px;
  }

  .content-img-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .listImg {
    max-width: 180px;
  }

/* 大屏加左边距 */
  @media screen and (min-width:1000px) {
    .outMain {
      padding-left: 80px;
      padding-top: 30px;
    }
  }
/* 小屏调小字体 */
    @media screen and (max-width:450px) {
    .outMain {
      font-size: 12px;
    }
  }

</style>

